Skip to content

Conversation

@glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Dec 12, 2025

This workflow automates the process of publishing a Rust crate to crates.io, including version checking, tagging, building, and generating a Software Bill of Materials (SBOM).

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Adds an automated GitHub Actions workflow to tag, test, publish, and attach an SBOM when releasing the Rust crate to crates.io 🚀

📊 Key Changes

-Introduces a new .github/workflows/publish.yml workflow that runs on main pushes or manual dispatch
-Automatically checks Cargo.toml version, compares against existing git tags, and creates a new annotated tag + GitHub Release when needed 🏷️
-Adds CI gates before publishing: cargo fmt, cargo clippy, and cargo test
-Publishes the crate to crates.io using cargo publish with a protected environment token 🔐
-Generates and uploads an SPDX JSON SBOM (sbom.spdx.json) to the GitHub Release 📦

🎯 Purpose & Impact

-Streamlines and standardizes Rust crate releases, reducing manual steps and release mistakes
-Ensures only version-incremented releases publish, with quality checks enforced before publish
-Improves release transparency and compliance by attaching an SBOM to each tagged release

This workflow automates the process of publishing a Rust crate to crates.io, including version checking, tagging, building, and generating a Software Bill of Materials (SBOM).

Signed-off-by: Glenn Jocher <[email protected]>
@UltralyticsAssistant UltralyticsAssistant added the enhancement New feature or request label Dec 12, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @glenn-jocher, thank you for submitting a ultralytics/inference 🚀 PR! This is an automated note to help streamline review—an engineer will assist shortly. 😊

-✅ Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
-✅ Synchronize with Source: Confirm your PR is synchronized with the ultralytics/inference main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
-✅ Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
-✅ Update Documentation: Update the relevant documentation for any new or modified features.
-✅ Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
-✅ Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
-✅ Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

Copy link
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Fix the workflow so it can run reliably: use valid action versions (not actions/checkout@v6), avoid creating tags/releases before CI + cargo publish succeed, and harden the version-check step output writing. Also improve release/publish robustness by using stable Rust for CI, running cargo publish --locked, making SBOM upload idempotent, and correcting the crates.io URL to the actual crate for this repo.

💬 Posted 7 inline comments

@glenn-jocher
Copy link
Member Author

@onuralpszr let's not merge this until we define package name and ready to publish, as this will likely publish a first version on PR merge.

@glenn-jocher
Copy link
Member Author

TODO: Update L26 crate_url: https://crates.io/crates/ultralytics-template-rust

@onuralpszr
Copy link
Member

@onuralpszr let's not merge this until we define package name and ready to publish, as this will likely publish a first version on PR merge.

yes we can do meeting and decide when it is time

Copy link
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR Review 2

Made with ❤️ by Ultralytics Actions

Overall the workflow structure is solid (version check → tag/release → build gates → publish → SBOM upload), but there are a few reliability issues to address: the shell: python step may not execute on Ubuntu runners, the ls-remote call can silently fail and cause an incorrect publish decision, and the SBOM upload isn’t idempotent without --clobber. Also, the workflow_dispatch input is currently unused, and the crate URL appears to point to a template rather than this repo’s crate.

💬 Posted 6 inline comments

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants